function login() {
    var username = $("#username").val();
    var password = $("#password").val();
    if($.trim(username)=="" || $.trim(password)==""){
        $("#msg").html("请输入账号和密码！");
        console.log(1);
        return;
    }
    $.ajax({

        url:"dologin",
        type:"post",
        data:{username:username,password:password},
        dataType:"json",
        success:function (res) {
            if(res.code==0){
                location.href="index";
            }else{
                $("#msg").html(res.msg);
            }
        }
    });
}
function clearMsg(){
    $("#msg").empty();
}